home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: jlilley@ix.netcom.com (John Lilley)
- Newsgroups: comp.lang.c++
- Subject: Re: linking C & C++
- Date: 16 Mar 1996 16:49:18 GMT
- Organization: Nerds for Hire, Inc.
- Distribution: world
- Message-ID: <4ieree$dqv@cloner3.netcom.com>
- References: <4ibsla$pll@news.onramp.net>
- NNTP-Posting-Host: den-co12-24.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-NETCOM-Date: Sat Mar 16 8:49:18 AM PST 1996
- X-Newsreader: WinVN 0.99.7
-
- In article <4ibsla$pll@news.onramp.net>, dean@onramp.net says...
- >
- >I'm doing some work on a system that now requires me to do a longjmp from a C
- >program back into a C++ program. The whole thing is linked into one big
- >executable. I am having some trouble getting the thing linked, and I have
- >tried a number of different combinations. What I have is a signal(), and
- >alarm(), and a longjmp() in the C file, and a setjmp() in the C++ file. I have
- >tried defining the jmpbuffer in both files with it as an exter in the other,
- >but the linker always gives me a not-found condition for the jmpbuffer.
-
- Not seeing the code, I can only guess, but its probably the C/C++ name
- decoration problem:
-
- try this:
-
- // header.h
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- extern jmp_buf myJumpBuffer;
-
- #ifdef __cplusplus
- }
- #endif
-
-
- //source1.c
- #include "header.h"
- jmp_buf myJumpBuffer;
-
- // source2.cpp
- #include "header.h"
-
-
- Hope it helps.
-
- john lilley
-
- =========================================================================
- || John Lilley phone: 303-415-1860 ||
- || Nerds for Hire, Inc. fax: 303-415-1923 ||
- || "Nerds for all seasons" jlilley@ix.netcom.com ||
- =========================================================================
-
-